package com.hl.mapper;

import com.hl.pojo.ConsultantExcellence;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ConsultantExcellenceMapper {

    // 添加咨询师领域信息
    @Insert("insert into consultant_excellence (consultant_id, excellence_id) values (#{consultantId}, #{excellenceId})")
    public Integer add(ConsultantExcellence consultantExcellence);

    // 查询所有咨询师领域信息（未删除）
    @Select("select * from consultant_excellence where del = 0")
    public List<ConsultantExcellence> findAll();

    // 根据顾问ID和卓越ID删除顾问卓越信息
    @Update("update consultant_excellence set del = 1 where consultant_id = #{consultantId} and excellence_id = #{excellenceId}")
    public Integer del(@Param("consultantId") Integer consultantId,@Param("excellenceId") Integer excellenceId);

    // 根据咨询师ID查询卓越信息
    @Select("select * from consultant_excellence where consultant_id = #{consultantId} and del = 0")
    public List<ConsultantExcellence> findByConsultantId(Integer consultantId);

    // 根据卓越ID查询顾问信息
    @Select("select * from consultant_excellence where excellence_id = #{excellenceId} and del = 0")
    public List<ConsultantExcellence> findByExcellenceId(Integer excellenceId);

    // 更新顾问卓越信息
    @Update("update consultant_excellence set excellence_id=#{newExcellenceId} where consultant_id=#{consultantId} and excellence_id=#{oldExcellenceId}     ")
    public Integer update(@Param("newExcellenceId") Integer newExcellenceId ,@Param("consultantId") Integer consultantId ,@Param("oldExcellenceId") Integer oldExcellenceId);

}